﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace Acme.BookStore.Migrations
{
    /// <inheritdoc />
    public partial class Fleetcar : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Fleetcar",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    OrderId = table.Column<int>(type: "integer", nullable: false),
                    Shipper = table.Column<string>(type: "text", nullable: false),
                    ShipperAddress = table.Column<string>(type: "text", nullable: false),
                    Consignee = table.Column<string>(type: "text", nullable: false),
                    ConsigneeAddress = table.Column<string>(type: "text", nullable: false),
                    VehicleNumber = table.Column<string>(type: "text", nullable: false),
                    Goods = table.Column<string>(type: "text", nullable: false),
                    PieceCount = table.Column<int>(type: "integer", nullable: false),
                    Declaration = table.Column<string>(type: "text", nullable: false),
                    CubicMeterss = table.Column<int>(type: "integer", nullable: false),
                    Weightk = table.Column<int>(type: "integer", nullable: false),
                    Lengthm = table.Column<int>(type: "integer", nullable: false),
                    Widthm = table.Column<int>(type: "integer", nullable: false),
                    Heightm = table.Column<int>(type: "integer", nullable: false),
                    FreightAmount = table.Column<int>(type: "integer", nullable: false),
                    ReturnRequired = table.Column<string>(type: "text", nullable: false),
                    Quyu = table.Column<string>(type: "text", nullable: false),
                    CustomerNo = table.Column<int>(type: "integer", nullable: false),
                    OrderNo = table.Column<string>(type: "text", nullable: false),
                    Remarks = table.Column<string>(type: "text", nullable: false),
                    ExtraProperties = table.Column<string>(type: "text", nullable: false),
                    ConcurrencyStamp = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    CreationTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    CreatorId = table.Column<Guid>(type: "uuid", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "uuid", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Fleetcar", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Fleetcar_AppOrders_OrderId",
                        column: x => x.OrderId,
                        principalTable: "AppOrders",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_Fleetcar_OrderId",
                table: "Fleetcar",
                column: "OrderId");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Fleetcar");
        }
    }
}
